home *** CD-ROM | disk | FTP | other *** search
- /*
- * File: ScriptValue.h
- *
- * Contains: xxx put contents here xxx
- *
- * Written by: Rick Violet
- *
- * Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
- *
- * Change History (most recent first):
- *
- * <1+> 5/18/93 RV Added literal values for ValueKind enum
- * 11/18/92 RV xxx put comment here xxx
- *
- * To Do:
- */
-
- #ifndef __ScriptValue__
- #define __ScriptValue__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __APPLEEVENTS__
- #include <AppleEvents.h>
- #endif
-
- #ifndef __STRING__
- #include <String.h>
- #endif
-
- #ifndef __VUAE__
- #include "VUAE.h"
- #endif
-
- #ifndef __Object__
- #include "Object.h"
- #endif
-
- enum ValueKind
- {
- kVUAnyKind = -2,
- kVUNullKind = -1,
- kVUBooleanKind = 0,
- kVUNumberKind = 1,
- kVULongNumberKind = 2,
- kVUStringKind = 3,
- kVUListKind = 4
- };
-
- class ScriptValue;
-
- typedef ScriptValue* ScriptValuePtr;
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // ScriptValue class - abstract class for values passed to and from V.U. scripts
- //—————————————————————————————————————————————————————————————————————————————————————
- class ScriptValue : public Object
- {
- ScriptValue* fNextValue;
-
- protected: //——————————————————————— protected member variables
- ValueKind fValueKind;
-
- public: //——————————————————————— public member functions
-
- ScriptValue();
- virtual ~ScriptValue(){};
-
- ValueKind GetValueKind(){ return fValueKind; };
- ScriptValue* GetNextValue(){ return fNextValue; };
- void SetNextValue( ScriptValue* pValue ){ fNextValue = pValue; };
- virtual ScriptValue* Clone();
- };
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // VUNull class - for undefined values passed to and from V.U. scripts
- //—————————————————————————————————————————————————————————————————————————————————————
- class VUNull: public ScriptValue
- {
- public: //——————————————————————— public member functions
-
- VUNull();
- virtual ~VUNull(){};
- virtual ScriptValue* Clone();
- };
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // VUBoolean class - for boolean values passed to and from V.U. scripts
- //—————————————————————————————————————————————————————————————————————————————————————
- class VUBoolean: public ScriptValue
- {
- Boolean fFlag;
-
- public: //——————————————————————— public member functions
-
- VUBoolean( Boolean pFlag );
- virtual ~VUBoolean(){};
- Boolean GetBoolean();
- virtual ScriptValue* Clone();
- };
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // VUNumber class - for number values passed to and from V.U. scripts
- //—————————————————————————————————————————————————————————————————————————————————————
- class VUNumber: public ScriptValue
- {
- short fNumber;
-
- public: //——————————————————————— public member functions
-
- VUNumber( short pNumber );
- virtual ~VUNumber(){};
- short GetNumber();
- virtual ScriptValue* Clone();
- };
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // VULongNumber class - for return id of apple events, which identify Requests
- // to be canceled.
- //—————————————————————————————————————————————————————————————————————————————————————
- class VULongNumber: public ScriptValue
- {
- long fNumber;
-
- public: //——————————————————————— public member functions
-
- VULongNumber( long pNumber );
- virtual ~VULongNumber(){};
- long GetNumber();
- virtual ScriptValue* Clone();
- };
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // VUNumber class - for string values passed to and from V.U. scripts
- //—————————————————————————————————————————————————————————————————————————————————————
- class VUString: public ScriptValue
- {
- char* fText;
-
- public: //——————————————————————— public member functions
-
- VUString( char* pText );
- virtual ~VUString();
-
- //———— Returns a pointer to the Text
- char* GetText();
- unsigned
- short GetTextSize();
-
- virtual ScriptValue* Clone();
- };
-
- //—————————————————————————————————————————————————————————————————————————————————————
- // VUList class - for list values passed to and from V.U. scripts
- //—————————————————————————————————————————————————————————————————————————————————————
- class VUList: public ScriptValue
- {
- short fCount;
- ScriptValue* fListHead;
-
- public: //——————————————————————— public member functions
-
- //———— Constructor - creating for reply
- VUList();
-
- //———— Destructor
- virtual ~VUList();
-
- //———— Get the number of items in the list
- short GetCount();
-
- private: //——————————————————————— private member functions
-
- //———— Get the indexed item from the list
- //———— returns nil in case of error
- ScriptValue* GetNthItem( short pIndex );
-
- public: //——————————————————————— public member functions
-
- //———— Get the indexed item from the list
- OSErr GetNthItem( short pIndex, ScriptValuePtr& pItemPtr, ValueKind& pKind );
-
- //———— Insert a ScriptValue into the list at the indexed position
- void PutNthItem( ScriptValue* pValue, short pIndex = 32767 );
-
- //———— Insert a Boolean into the list at the indexed position
- void PutNthItem( Boolean pFlag, short pIndex = 32767 );
-
- //———— Insert a Number into the list at the indexed position
- void PutNthItem( short pNumber, short pIndex = 32767 );
-
- //———— Insert a ScriptValue into the list at the indexed position
- void PutNthItem( char* pString, short pIndex = 32767 );
-
- //———— Insert a long Number into the list at the indexed position
- void PutNthItem( long pNumber, short pIndex = 32767 );
-
- virtual ScriptValue* Clone();
- };
-
-
- #endif
-